cmake_minimum_required(VERSION 3.14)
project(Leetcode)
include(cmake/check.cmake)
enable_testing()

# 设置打包软件版本
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "1")
set(VERSION
    ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}
)
<<<<<<< HEAD
set(CXX_STANDARD 20)

# 设置地址检查
set(CMAKE_CXX_FLAGS_DEBUG
    "$ENV{CXXFLAGS} -O0 -g -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(algrithm_module
    "${CMAKE_SOURCE_DIR}/algorithm"
    CACHE INTERNAL "algorithm module path")
set(datastruct_module
    "${CMAKE_SOURCE_DIR}/datastruct"
    CACHE INTERNAL "datastruct module path")
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
# 设置头文件查找路径
include_directories(${algrithm_module}/include)
include_directories(${datastruct_module}/graph/include)
include_directories(${datastruct_module}/tree/include)
=======

include_directories(${CMAKE_SOURCE_DIR})
# 设置地址检查 SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -g -fsanitize=address
# -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
# -fsanitize=address")

set(CMAKE_CXX_STANDARD 20)
>>>>>>> dev
# 设置静态地址检查
set(CMAKE_CXX_FLAGS_DEBUG
    "$ENV{CXXFLAGS} -O0 -g -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer")

# 设置gprof性能分析
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")

option(BUILD_TEST "Build the Test" ON)
if(BUILD_TEST)
  add_subdirectory(test)
endif()

option(BUILD_BM "Build the Benchmark" OFF)
if(BUILD_BM)
  add_subdirectory(benchmark)
endif()
option(BUILD_TOOLS "Build Tools" OFF)
if(BUILD_TOOLS)
  add_subdirectory(tools)
endif()
add_subdirectory(algorithm)

add_executable(${PROJECT_NAME} main.cc)
target_link_libraries(
  ${PROJECT_NAME}
  dp
  common
  recursion
  datastruct
  greedy
  backtrack)
